import { defHttp } from '@/utils/http/axios';

/** 获取下载附件的url */
export const getFileUrl = async (data) => {
  return defHttp.request({
    url: '/system/oss/file/getObjectUrl',
    method: 'post',

    data,
  });
};

/** 上传文件 */
export async function uploadFile(data): Promise<{
  code: number;
  fileName: string;
  msg: string;
  newFileName: string;
  originalFilename: string;
  url: string;
}> {
  return defHttp.request({
    url: '/common/upload',
    method: 'post',
    headers: {
      'uploadFile': true,
      'Content-Type': 'multipart/form-data',
    },

    data,
  });
}
